<?php
//$proId=$_REQUEST['products'];
require_once "includes/class/member_management.class.php";
require_once('AmazonAPI/.config.inc.php');
require_once "includes/functions.php";

 //echo $pthumb;

?>
<script language="javascript" type="text/javascript">
	function showHide(id){
		var dID = document.getElementById("det_"+id);
		if(dID.style.display == 'none'){
			dID.style.display = '';
		}else{
			dID.style.display = 'none';
		}
	}
</script>




<table width="100%" border="0">
<?php if($_SESSION['order_msg'])
{?>
  <tr>
    <td align="center" class="contentHeader"><strong><?php echo $_SESSION['order_msg'];$_SESSION['order_msg']="";?></strong></td>
  </tr>
  <?php }?>
  
  <tr>
    <td class="contentHeader"><h2>My Orders </h2></td>
  </tr>
  <tr>
    <td>
      <table width="100%" border="0" cellpadding="5">
        <tr>
          <td width="31%"><strong>Items </strong></td>
          <td width="18%"><strong>Amount</strong></td>
		  <td width="36%"><strong>Status </strong></td>
          <td width="9%"><strong>Date</strong></td>
          <td width="6%" colspan="2"><strong>Qty</strong></td>
		  <td width="6%" colspan="2"></td>
        </tr>
        <?php
		$i=0;
		 $sqlCart="select * from tbl_orders where ordered_by='".$_SESSION['user_id_sess']."'";
	  $resCart=mysql_query($sqlCart);
	  $cart_num = mysql_num_rows($resCart);
	  if($cart_num > 0){
	  while($rowCart=mysql_fetch_array($resCart))
	  {
	  	
	  
	  ?>
        <tr>
          <td valign="top"><?php echo $rowCart['item_name']; ?></td>
          <td valign="top"><?php echo $rowCart['order_amount'];?></td>
		  <td valign="top"><?php echo "Complete"; //$rowCart['transaction_status'];?></td>
          <td valign="top"><?php echo date('d/m/Y', strtotime($rowCart['order_date']));?></td>
		  <td valign="top"><?php echo $rowCart['qty'];?></td>
		  <td valign="top"><a href="#" onclick="showHide(<?php echo $rowCart['order_id'];?>); return false;">Details</a></td>
        </tr>
		<tr id="det_<?php echo $rowCart['order_id'];?>" style="display:none">
          <td valign="top" colspan="6">
		  	<table border="0" width="100%" style="border:1px solid #333333;">
				<tr><td align="left">Transaction ID</td><td align="left"><?php echo $rowCart['transaction_ID'];?></td></tr>
				<tr><td align="left">Transaction Status</td><td align="left"><?php echo "Complete"; //$rowCart['transaction_status'];?></td></tr>
				<tr><td align="left">Request ID</td><td align="left"><?php echo $rowCart['requestId'];?></td></tr>
			</table>
		  </td>
        </tr>
       
     <?php }?>
	 <?php }else{?>
		 
		 <tr>
		   <td colspan="8" align="center" valign="top"><strong>Your Order table is empty</strong></td>
	    </tr>
		<?php }?>
    </table>    </td>
  </tr>
</table>
		 
